<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./three.min.js"></script>
    <script src="./OrbitControls.js"></script>
    <script src="./dist/MYDXFViewer.js"></script>

    <style>
        #box {
            width: 100vw;
            height: 100vh;
            display: inline-block;
        }
        #box canvas{
            width: 100%;
            height: 100%;
        }
    </style>
</head>

<body>
    <div id="box">

    </div>

    <script>
        let container = document.getElementById('box');
        let DXFViewer = MYDXFViewer.default;
        console.log(MYDXFViewer, DXFViewer);
        const scene = new THREE.Scene();
        scene.background = new THREE.Color(0x000000);

        const camera = new THREE.PerspectiveCamera( 45, container.clientWidth / container.clientHeight, 0.1, 1200 );
        camera.name = "camera";
        camera.position.set(0, 0, 1200);
        camera.aspect = container.clientwidth / container.clientHeight;
        camera.updateProjectionMatrix();
        scene.add(camera);
        const renderer = new THREE.WebGLRenderer({
            antialias: true,//设置抗锯齿
            alpha: false,
            logarithmicDepthBuffer: true,//是否使用对数深度缓存
        });
        renderer.setSize( container.clientwidth, container.clientHeight);

        renderer.setPixelRatio(window.devicePixelRatio);
        container.appendChild(renderer.domElement);
        const controller = new THREE.OrbitControls( camera, renderer.domElement)
        controller.enablePan = true;
        controller.target.set(0, 0.5, 0)


        const viewer=new DXFViewer();
        async function get1(){
          let dxf= await viewer.getFromPath('./6.dxf','./helvetiker_regular.typeface.json');
          console.log(dxf);
          scene.add(dxf)

        }
        // let dxf=get1()
        get1();
        function render() {
            requestAnimationFrame(render);
            renderer.render(scene, camera);
        }
        render();
    </script>

</body>

</html>